﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Zsea.HTML
{
    public class AttributeCollection:List<Attribute>
    {
        // Fields
        //private List<Attribute> _item = new List<Attribute>();

        // Methods
        public new void Add(Attribute item)
        {
            if ((item != null) && (item.Name != "/"))
            {
                //this._item.Add(item);
                base.Add(item);
            }
        }

        //public bool Exists(Predicate<Attribute> match)
        //{
        //    return this._item.Exists(match);
        //}

        //public Attribute Find(Predicate<Attribute> match)
        //{
        //    return this._item.Find(match);
        //}

        public Attribute Find(string name)
        {
            return base.Find(delegate(Attribute o)
            {
                return o.Name.ToUpper() == name.ToUpper();
            });
        }

        //public List<Attribute> FindAll(Predicate<Attribute> match)
        //{
        //    return this._item.FindAll(match);
        //}

        public override string ToString()
        {
            return string.Format("Count={0}", base.Count);
        }

        // Properties
        //public int Count
        //{
        //    get
        //    {
        //        return this._item.Count;
        //    }
        //}

        public Attribute this[string name]
        {
            get
            {
                return this.Find(name);
            }
        }

        //public Attribute this[int index]
        //{
        //    get
        //    {
        //        return base[index];
        //    }
        //}
    }





}
